package com.lancoo.znbkxx.teacher.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.model.data.ImportKlg
import kotlinx.android.synthetic.main.item_zsd.view.*

/**
 *@author Admin
 *@date 2021/1/28
 *
 */
class ZSdListAdapter(data: List<ImportKlg>) :
        BaseQuickAdapter<ImportKlg, BaseViewHolder>(data) {
    init {
        mLayoutResId = R.layout.item_zsd
    }

    override fun convert(helper: BaseViewHolder, item: ImportKlg?) {
        with(helper.itemView) {
            tv_zsd.text = item?.Name
            tv_zsd.isChecked = item?.IsSelect == 1
            tv_zsd.setOnCheckedChangeListener { buttonView, isChecked ->
                if (isChecked) {
                    data[helper.layoutPosition].IsSelect = 1
                } else {
                    data[helper.layoutPosition].IsSelect = 0
                }
            }
        }
    }
}